//
//  LzwLandingView.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/6.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwLandingView.h"



@implementation LzwLandingView

-(void)dealloc{
    [_landingText1 release];
    [_landingText2 release];
    [_LandingUserAcountLabel release];
    [_LandingUserAcountLabel release];
    [_myImage release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        [self creatLandView];
    }
    return self;
    
}
//键盘回收
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
    //调用回收方法
    [textField resignFirstResponder];
    
    return YES;
}

-(void)creatLandView{
    
//    self.myImage = [[LzwBaseImageView alloc]initWithFrame:self.bounds];
//    self.myImage.image =[UIImage imageNamed:@"denlu.png"];
//    [self addSubview:self.myImage];
    
    
    self.LandingUserAcountLabel = [[UILabel alloc]initWithFrame:CGRectMake(50 * WIDTH, 170 * WIDTH, 60 * WIDTH, 30 * WIDTH)];
    self.LandingUserAcountLabel.text = @"用户名";
    self.LandingUserAcountLabel.textAlignment = YES;
    self.LandingUserAcountLabel.textColor = [UIColor blackColor];
    [self addSubview:self.LandingUserAcountLabel];
    
    self.LandingUserCodeLabel = [[UILabel alloc]initWithFrame:CGRectMake(50 * WIDTH, 270 * WIDTH, 60 * WIDTH, 30 * WIDTH)];
    self.LandingUserCodeLabel.text = @"密码";
    self.LandingUserCodeLabel.textAlignment = YES;
    self.LandingUserCodeLabel.textColor = [UIColor blackColor];
    self.LandingUserCodeLabel.font = [UIFont systemFontOfSize:20 * WIDTH];
    [self addSubview:self.LandingUserCodeLabel];
    
    
    self.landingText1 = [[UITextField alloc]initWithFrame:CGRectMake(150 * WIDTH, 170 * WIDTH, 200 * WIDTH, 30 * WIDTH)];
    self.landingText1.placeholder = @"请输入用户名";
//    self.landingText1.layer.masksToBounds = YES;
//    self.landingText1.layer.cornerRadius = 15;
    self.landingText1.borderStyle = UITextBorderStyleRoundedRect;
    self.landingText1.keyboardType = UIKeyboardTypeDefault;
    self.landingText1.clearButtonMode = UITextFieldViewModeAlways;
    
    self.landingText1.delegate = self;
    [self addSubview:self.landingText1];
    
    self.landingText2 = [[UITextField alloc]initWithFrame:CGRectMake(150 * WIDTH, 270 * WIDTH, 200 * WIDTH, 30 * WIDTH)];
    self.landingText2.placeholder = @"请输入密码";
    self.landingText2.borderStyle = UITextBorderStyleRoundedRect;
    self.landingText2.secureTextEntry = YES;
//    self.landingText2.layer.masksToBounds = YES;
//    self.landingText2.layer.cornerRadius = 5;
    self.landingText2.clearButtonMode = UITextFieldViewModeAlways;
    
    self.landingText2.delegate = self;
    [self addSubview:self.landingText2];
    
    

    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(60 * WIDTH, 380 * WIDTH, 120 * WIDTH, 40 * WIDTH);
    button.layer.masksToBounds = YES;
    button.layer.cornerRadius = 20 * WIDTH;
    
    
    button.backgroundColor = [UIColor blueColor];
    [button setTitle:@"登陆" forState:UIControlStateNormal];
    [self addSubview:button];
    
    
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    button1.frame = CGRectMake(220 * WIDTH, 380 * WIDTH, 120 * WIDTH, 40 * WIDTH);
    button1.backgroundColor = [UIColor orangeColor];
    button1.layer.masksToBounds = YES;
    button1.layer.cornerRadius = 20 * WIDTH;
    [button1 setTitle:@"注册" forState:UIControlStateNormal];
    
    
    [button addTarget:self action:@selector(DengluAction:) forControlEvents:UIControlEventTouchUpInside];
    [button1 addTarget:self action:@selector(ZhuceAction:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:button1];
    

}

//登陆按钮
- (void)DengluAction:(UIButton *)but{
    [self.myLandDelegata LandingButtonAction];
}
//注册按钮
- (void)ZhuceAction:(UIButton *)button{
    
    [self.myLandDelegata pushZhucePage];
    
}

@end
